<template>
	<view class="p-10">


		<view class="bg-white p-20 " style="padding-bottom: 50px">
	 
	<uni-table   border stripe @selection-change="selectionData">
		<uni-tr style=" position:sticky;top: 0;z-index: 999;">
	
			<uni-th v-for="(item,index) in th_list" align="center" >{{item.name}}</uni-th>
	
		 
	
		</uni-tr>
		<uni-tr v-for="(vo,index) in list" :key="index">
			
			
			<uni-td align="center"  v-for="(item,index) in th_list" >
				{{vo[item.field]}}
			</uni-td>
		 
	
		 
		</uni-tr>
	</uni-table>
<!-- 			<view class=" p-t-20 bg-white">
				<uni-pagination @change="getPage" show-icon="true" :total="total" current="1"
					style="float: left;margin-bottom: 10px;"></uni-pagination>
			</view>

			<edit ref="component_edit" @confirm="confirm_edit">
			</edit>
			<uni-popup ref="component_dels" type="center">
				<dels :id="id" @confirm="confirm_dels">
				</dels>
			</uni-popup> -->
		</view>
	</view>
</template>

<script>
	import edit from './edit.vue';
	import dels from './dels.vue';
	export default {
		components: {
			edit,
			dels
		},
		data() {
			return {

                th_list:[],
				find: {},
				list: [],
				total: 0,
				page: 1,
				id: 0,
				is_top_height: false,
			}
		},
		onLoad(on) {

			this.init();
		},

		methods: {
			//全选 反选
			selectionData(list) {
				console.log("list: " + JSON.stringify(list));
			},
			on_dels(index) {
				this.id = this.list[index]['id'];
				this.$refs.component_dels.open()
			},
			confirm_dels() {
				this.init();
				this.$refs.component_dels.close()
			},

			on_switch_open(index, val) {
				var that = this;
				var id = this.list[index]['id'];
				let requestParams = {
					id: id,
				};
				this.Http.post('/banmichaoqiangbizhi/admin/Adjump/switch_open', requestParams).then(ret => {
					this.list[index]['open'] = ret.data
				})
			},
			on_edit(index) {
				this.id = this.list[index]['id'];
				this.$refs.component_edit.init(this.id)
			},
			confirm_edit() {
				if (this.id == 0) {
					this.page = 1;
				}
				this.init();

			},


			getPage(id) {
				this.page = id.current;
				this.init()
			},
			on_add() {
				this.id = 0;
				this.$refs.component_edit.init(0)
			},
			on_search() {
				this.init();
			},
			on_search_resetting() {
				this.find = {};
				this.page = 1;
				this.init();
			},
			init() {
				var that = this;
				this.find['page'] = this.page
				this.Http.post('banmichaoqiangbizhi/admin/Adjump/lists', this.find).then(ret => {
				 
					this.th_list = ret.data.th_list;
					this.list = ret.data.list;
				})
			},
		}
	}
</script>

<style>
	.operate_button {
		width: 70px;
	}

	.operate_right {
		position: sticky;
		right: 0;
		z-index: 100;
		background-color: #fff;
	}
</style>